import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { observer } from "mobx-react-lite";
import counter from "@/store/index";
import { ipc } from "@/utils/ipcRenderer";

const HomePage = () => {
  // navigate
  const navigate = useNavigate();

  const toLoginPage = () => {
    navigate("/login");
  };

  /* Effect */
  useEffect(() => {}, []);

  const showDialog = () => {
    ipc.send("dialog");
  };

  return (
    <>
      {/* <div onClick={toLoginPage}>Home</div>
      <div>
        <h3>计数器案例</h3>
        <div>点击次数：{counter.count}</div>
        <button onClick={() => counter.increment()}>加1</button>
        <button onClick={() => counter.decrement()}>减1</button>
        <button onClick={() => counter.reset()}>重置</button>
      </div> */}
      <div>
        <button onClick={showDialog}>显示Dialog</button>
      </div>
    </>
  );
};

export default observer(HomePage);
